package com.sweet.fourtimeoa.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.sweet.fourtimeoa.mapper.OperationLogMapper;
import com.sweet.fourtimeoa.pojo.dto.DocumentList;
import com.sweet.fourtimeoa.pojo.dto.PageDto;
import com.sweet.fourtimeoa.pojo.dto.SystemOperationLogList;
import com.sweet.fourtimeoa.pojo.dto.SystemOperationLogQueryDto;
import com.sweet.fourtimeoa.pojo.vo.PageVo;
import com.sweet.fourtimeoa.service.OperationLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OperationLogServiceImpl implements OperationLogService {
    @Autowired
    private OperationLogMapper operationLogMapper;
    @Override
    public PageVo<SystemOperationLogList> getSystemOperationLogList(PageDto<SystemOperationLogQueryDto> pageDto) {
        PageHelper.startPage(pageDto.getPageNum(), pageDto.getPageSize());
        Page<SystemOperationLogList> list =(Page<SystemOperationLogList>)operationLogMapper.getSystemOperationLogList(pageDto.getData());
        PageVo<SystemOperationLogList> pageVo = new PageVo<>();
        pageVo.setPageNum(list.getPageNum());
        pageVo.setPageSize(list.getPageSize());
        pageVo.setTotal(list.getTotal());
        pageVo.setPages(list.getPages());
        pageVo.setList(list.getResult());
        return pageVo;
    }
}
